<?php defined('BASEPATH') || exit('No direct script access allowed');

/**
 * Building controller
 */
class Car extends Api_Controller
{
    /**
     *  @apiDefine Car 车型
     */
    function __construct()
    {
        // Construct the parent class
        parent::__construct();
        $this->load->model('car_m');
    }

    /**
     * @api               {get} car/index 车型列表
     * @apiGroup          Car
     * @apiName           car/index
     * @apiVersion        1.0.0
     * @apiDescription    车型列表
     * @apiSampleRequest https://api.bjxpel.cn/api/car/index
     * @apiSuccess   {String} car_icon 车标图案
     * @apiSuccess   {String} car_name 车型名称
     * @apiSuccessExample 成功响应
     *          {
     *           "message": "ok",
     *           "code": 200,
     *           "data": null
     *          }
     * @apiErrorExample   失败响应
     *            {
     *             "message": "err",
     *             "code": 0,
     *             "data": null
     *            }
     */
    public function index()
    {
        $car = $this->car_m->select();
        if (!$car) {
            return $this->failure();
        }
        return $this->success(['list' => $car]);
    }

}